unit addinvoice;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, BufDataset, FileUtil, Forms, Controls, Graphics, Dialogs,
  ComCtrls, ExtCtrls, StdCtrls, Grids, Buttons, add_invoice_elem;

type

  { TaddInvoiceForm }

  TaddInvoiceForm = class(TForm)
    addElem: TBitBtn;
    Button1: TButton;
    cliDataBox: TGroupBox;
    optionsBox: TGroupBox;
    invoiceElemsBox: TGroupBox;
    invoiceElementsGrid: TStringGrid;
    procedure addElemClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  addInvoiceForm: TaddInvoiceForm;

implementation

{$R *.lfm}

{ TaddInvoiceForm }

procedure TaddInvoiceForm.addElemClick(Sender: TObject);

var

   elementData : array[0..9] of String;
   i : integer;
   rowIndex : integer;

begin
     addInvoiceElementFrom.showModal;
     if addInvoiceElementFrom.inserted then
        begin
          invoiceElementsGrid.rowcount := invoiceElementsGrid.rowcount + 1;

          elementData := addInvoiceElementFrom.getData;
          rowIndex := invoiceElementsGrid.rowcount - 1;
          for i:= 0 to 7 do
              begin
                invoiceElementsGrid.Cells[i,rowIndex] := elementData[i];
              end;


        end;

end;

procedure TaddInvoiceForm.FormCreate(Sender: TObject);
begin

end;

end.

